from PyPDF2 import PdfWriter
from PIL import Image

image_path = 'path_to_your_image.jpg'
pdf_path = 'output_pdf.pdf'

image = Image.open(image_path)
pdf = PdfWriter()

pdf.add_page()
pdf.add_image(image, width=image.width, height=image.height)

with open(pdf_path, 'wb') as f:
    pdf.write(f)
